package com.itboye.ihomebank.adapter.jinrong;

import android.content.Context;
import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.itboye.ihomebank.R;
import com.itboye.ihomebank.base.MyApplcation;

import java.util.List;

/**
 * Created by Mr.w on 2017/2/16.
 */

public class DataAdapter extends BaseAdapter {
    Context context;
    List<String> list;
    public DataAdapter(List<String> list,Context context){
        this.list=list;
        this.context=context;
    }
    @Override
    public int getCount() {
        return list==null?0:list.size();
    }

    @Override
    public Object getItem(int position) {
        return list==null?0:list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder=null;
        if (viewHolder==null) {
            viewHolder=new ViewHolder();
            convertView= LayoutInflater.from(context).inflate(R.layout.item_toubiaojilu,null);
            viewHolder.textView1= (TextView) convertView.findViewById(R.id.textView1);
            convertView.setTag(viewHolder);
        }else{
            viewHolder= (ViewHolder) convertView.getTag();
        }
        viewHolder.textView1.setText(list.get(position));
        return convertView;
    }

    public class ViewHolder{
        TextView textView1;
    }
}
